﻿<%@ Page Title="Book Contract" Language="C#" MasterPageFile="~/AuditBillingMaster.master" AutoEventWireup="true" CodeFile="Contracts.aspx.cs" Inherits="Contracts" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script src="../JS/Forms/jsContracts.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cntList" runat="Server">
    <asp:HiddenField runat="server" ID="hdnExportToExcelFilePath" ClientIDMode="Static" />
    <asp:HiddenField runat="server" ID="hdnUploadLink" ClientIDMode="Static" />
    <input type="hidden" id="hdnContractID" runat="server" value="0" clientidmode="Static" />
    <div class="pagecontent">
        <div class="headercontainer">
            <div class="headertextcontainer halfpanel">
                Book Contract
            </div>
            <div class="headerbuttoncontainer halfpanel">
                <a id="A1" href='javascript:void(0);' onclick="toggle_TopContainer();" tabindex="12" class="headersearchbutton" title="Toggle Search Panel" runat="server">Search</a>&nbsp;&nbsp;
                <a runat="server" href='javascript:void(0);' id="lnkAdd" tabindex="12" clientidmode="Static" class="headeraddbutton" title="Add Company"
                    onclick='javascript:ShowEditDiv(0,this);'>Add Contract</a>
                <a href="Contracts.aspx?Excel" class="headerexportbutton" tabindex="13">Export To Excel</a>

            </div>
        </div>
        <div id="divTopContainer" class="topcontainerwrapper">
            <div class="topcontainerSmall" onkeypress="javascript:return fireDefaultButton(event, 'btnSearch')">
                <div class="halfpanel">
                    <div class="row">
                        <asp:DropDownList ID="cboCompany" ClientIDMode="Static" runat="server" TabIndex="2" multiple="multiple" placeholder="All Companies"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboContract" ClientIDMode="Static" runat="server" TabIndex="4" multiple="multiple" placeholder="All Contracts"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>

                    <div class="clear"></div>
                    <div class="row">
                        <div class="labelPad4">
                            Contract Start Date
                        </div>
                        <div class="value">
                            <div class="input-append date">
                                <asp:TextBox ID="txtContractStartDate" runat="server" ClientIDMode="Static" MaxLength="50"
                                    onclick="show_DateCalender('txtContractStartDate');" TabIndex="6" CssClass="dateinput"
                                    ReadOnly="true" placeholder="dd/mm/yyyy" onkeydown="javascript:return clearDates(event);"></asp:TextBox>
                                <span class="add-on" id="Span8" onclick="show_DateCalender('txtContractStartDate');" style="float: right"><i
                                    class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="labelPad4">
                            Contract End Date
                        </div>
                        <div class="value">
                            <div class="input-append date">
                                <asp:TextBox ID="txtContractEndDate" runat="server" ClientIDMode="Static" MaxLength="50"
                                    onclick="show_DateCalender('txtContractEndDate');" TabIndex="7" CssClass="dateinput"
                                    ReadOnly="true" placeholder="dd/mm/yyyy" onkeydown="javascript:return clearDates(event);"></asp:TextBox>
                                <span class="add-on" id="Span5" onclick="show_DateCalender('txtContractEndDate');" style="float: right"><i
                                    class="icon-th"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="halfpanel">
                    <div class="row">
                        <asp:DropDownList ID="cboClient" ClientIDMode="Static" runat="server" TabIndex="3" multiple="multiple" placeholder="All Clients"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboPaymentMode" ClientIDMode="Static" runat="server" TabIndex="5" multiple="multiple" placeholder="All Payment Modes"
                            CssClass="searchCntrl" Width="70%">
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboStatus" ClientIDMode="Static" runat="server" TabIndex="8" placeholder="All Status"
                            CssClass="searchCntrl" Width="70%">
                            <asp:ListItem Value="2" Text="Both [Active / InActive]"></asp:ListItem>
                            <asp:ListItem Value="1" Text="Active"></asp:ListItem>
                            <asp:ListItem Value="0" Text="InActive"></asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <asp:DropDownList ID="cboCompletedStatus" ClientIDMode="Static" runat="server" TabIndex="8" placeholder="All Status"
                            CssClass="searchCntrl" Width="70%">
                            <asp:ListItem Value="2" Text="Both [Working / Completed]"></asp:ListItem>
                            <asp:ListItem Value="1" Text="Working"></asp:ListItem>
                            <asp:ListItem Value="0" Text="Completed"></asp:ListItem>
                        </asp:DropDownList>
                    </div>

                </div>
                <div class="fullpanel textalignright">
                    <a tabindex="9" class="btn-search-clear" onclick="clear_form_elements('divTopContainer');" onkeypress="clear_form_elements_ForTab(event,'divTopContainer');" href="javascript:void(0);">Clear</a>
                    <input type="button" id="btnSearch" tabindex="10" class="btn-search" onclick="javascript: return fn_GetSearchResult(0);"
                        value="Search" title="Search" />
                </div>
            </div>
            <a href='javascript:void(0);' class="closedivSmall" onclick="toggle_TopContainer();" title="Toggle Search Panel" tabindex="11"><i class="fa fa-chevron-up"></i></a>
        </div>
        <div class="maincontainer">
            <div class="listpagediv" id="divResult">
                <asp:GridView ID="grdResult" runat="server" ClientIDMode="Static" AutoGenerateColumns="false" Width="90%" CssClass="listdiv" DataKeyNames="TrnContractID" OnRowDataBound="grdResult_RowDataBound">
                    <Columns>
                        <asp:BoundField DataField="TrnContractID" HeaderText="Contrac ID" />
                        <asp:BoundField DataField="CompanyID" HeaderText="Company ID" />
                        <asp:BoundField DataField="ClientID" HeaderText="Client ID" />
                        <asp:BoundField DataField="ContractID" HeaderText="Contract ID" />
                        <asp:BoundField DataField="PaymentModeID" HeaderText="PaymentMode ID" />

                        <asp:BoundField HeaderText="Sr." ItemStyle-HorizontalAlign="Center" />
                        <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                 <%#(Convert.ToBoolean(Eval("IsCompleted")) == true ? "" : 
                                 "<a class=\"btn-edit\" href=\"javascript:void(0);\" onclick=\"return ShowEditDiv(1,this);\" title=\"Edit\"><i class=\"fa fa-pencil\" title=\"Edit\"></i></a>") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="ContractNo" HeaderText="Contract#" />
                        <asp:BoundField DataField="CompanyName" HeaderText="Company" />
                        <asp:BoundField DataField="ClientName" HeaderText="Client" />
                        <asp:BoundField DataField="ContractName" HeaderText="Contract" />
                        <asp:BoundField DataField="PaymentModeName" HeaderText="Payment Mode" />
                        <asp:BoundField DataField="ContractStartDate" HeaderText="Contract Start Date" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
                        <asp:BoundField DataField="ContractAmount" HeaderText="Contract Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                        <asp:BoundField DataField="InvoicedAmount" HeaderText="Invoiced Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                        <asp:BoundField DataField="DueAmount" HeaderText="Due Amt." ItemStyle-HorizontalAlign="Right" DataFormatString="{0:#0}" />
                        <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%#(Convert.ToBoolean(Eval("IsActive")) == true ? "Active" : "InActive") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Completed" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%#(Convert.ToBoolean(Eval("IsCompleted")) == true ? "Yes" : "No") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Document" ItemStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%#(Convert.ToString(Eval("ContractFilePath")) == "" ?"":
                                string.Format("<a href=\"{0}\" class=\"btn-edit\" target=\"_blank\" href=\"javascript:void(0);\"title=\"Download Document\"><i class=\"fa fa-download\" title=\"Download Document\"></i></a>",Eval("ContractFilePath").ToString())) 
                                %>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>

        </div>
    </div>
    <div class="modalopenConfirmDel modalopenPaymentLevel" style="display: none;">
    </div>

    <div id="divInsertEdit" class="modalPaymentLevel" onkeypress="javascript:return fireDefaultButton(event, 'btnSave')">
        <div class="form">
            <div class="innercontent">
                <div class="halfpanel">
                    <div class="row">
                        <div class="midium-label">
                            Company&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <asp:DropDownList ID="cboAddCompany" ClientIDMode="Static" runat="server" TabIndex="101" CssClass="searchCntrl" Width="70%">
                                <asp:ListItem Value="0" Text="[Select Company]"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvcboCompanyAdd" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="cboAddCompany" ValidationGroup="vgSave" ErrorMessage="Select Payment Mode" InitialValue="0"
                                Width="90%"><span class="error">Select company</span></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Contract&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <asp:DropDownList ID="cboAddContract" ClientIDMode="Static" runat="server" TabIndex="103" CssClass="searchCntrl" Width="70%">
                                <asp:ListItem Value="0" Text="[Select Contract]"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvcboAddContract" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="cboAddContract" ValidationGroup="vgSave" ErrorMessage="Select Contract" InitialValue="0"
                                Width="90%"><span class="error">Select contract</span></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Contract Start Date&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <div class="input-append date">
                                <asp:TextBox ID="txtAddContractStartDate" runat="server" ClientIDMode="Static" MaxLength="50"
                                    onclick="show_DateCalender('txtAddContractStartDate');" TabIndex="105" CssClass="dateinput"
                                    ReadOnly="true" placeholder="dd/mm/yyyy" onkeydown="javascript:return clearDates(event);"></asp:TextBox>
                                <span class="add-on" id="Span1" onclick="show_DateCalender('txtAddContractStartDate');" style="float: right"><i
                                    class="icon-th"></i></span>
                            </div>
                            <asp:RequiredFieldValidator ID="rfvtxtAddContractStartDate" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="txtAddContractStartDate" ValidationGroup="vgSave" ErrorMessage="Enter Contract Start Date" InitialValue=""
                                Width="90%"><span class="error">Enter contract start date</span></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Is Active
                        </div>
                        <div class="midium-value">
                            <asp:CheckBox ID="chkIsActive" runat="server" ClientIDMode="Static" TabIndex="107" />
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Contract Document
                        </div>
                        <div class="midium-value">
                            <asp:FileUpload ID="fupload" runat="server" ClientIDMode="Static" /><br /> 
                        </div>
                    </div>
                </div>
                <div class="halfpanel">
                    <div class="row">
                        <div class="midium-label">
                            Client&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <asp:DropDownList ID="cboAddClient" ClientIDMode="Static" runat="server" TabIndex="102" CssClass="searchCntrl" Width="70%">
                                <asp:ListItem Value="0" Text="[Select Contract]"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvcboAddClient" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="cboAddClient" ValidationGroup="vgSave" ErrorMessage="Select Client" InitialValue="0"
                                Width="90%"><span class="error">Select client</span></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Payment Mode&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <asp:DropDownList ID="cboAddPaymentMode" ClientIDMode="Static" runat="server" TabIndex="104" CssClass="searchCntrl" Width="70%">
                                <asp:ListItem Value="0" Text="[Select Contract]"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvcboAddPaymentMode" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="cboAddPaymentMode" ValidationGroup="vgSave" ErrorMessage="Select Payment Mode" InitialValue="0"
                                Width="90%"><span class="error">Select payment mode</span></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        <div class="midium-label">
                            Contract Amount&nbsp;&nbsp;<span class="red">*</span>
                        </div>
                        <div class="midium-value">
                            <asp:TextBox ID="txtAddContractAmount" runat="server" ClientIDMode="Static" Width="97%"
                                MaxLength="50" placeholder="Enter Contract Amount" CssClass="input" TabIndex="106"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvtxtAddContractAmount" runat="server" Display="Dynamic" ClientIDMode="Static"
                                ControlToValidate="txtAddContractAmount" ValidationGroup="vgSave" ErrorMessage="Enter Contract Amount"
                                Width="90%"><span class="error">Enter contract amount</span></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="cvtxtAddContractAmount" runat="server" ClientIDMode="Static" ControlToValidate="txtAddContractAmount"
                                ClientValidationFunction="fn_ValidateExpressionTextbox" ValidationGroup="vgSave" ValidateEmptyText="false" expressionid="NumDel"
                                Display="Dynamic" Width="90%"><span id="span1" class="error"></span></asp:CustomValidator>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <div class="row">
                        &nbsp;
                    </div>
                    <div class="clear"></div>
                    <div class="row"> 
                        &nbsp;
                    </div>
                </div>
                <div class="pagefooter">
                    <center>
                        <input type="button" id="btnSave" onclick="javascript: return fn_SaveDetails();"
                            tabindex="108" value="Save" validationgroup="vgSave" class="btn-primary" />
                    </center>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cntMain" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="FootContent" runat="Server">
</asp:Content>

